Query Language & Data Retrieval
This document describes data retrieval options exposed by the current Unity SDK facade.
Public retrieval API
Current public facade uses key-based entity retrieval with projection mapping:
var player = await PlayServ.SelectEntity<SamplePlayerEntity, SamplePlayerDto>(
playerId,
entity => new SamplePlayerDto
{
Id = entity?.Id ?? string.Empty,
Name = entity?.Name ?? string.Empty,
Level = entity?.Level ?? 0
});Working with multiple entities
For multiple entities, bind per id and keep shared handles:
var playerIds = new[] { "player-001", "player-002" };
var players = new List<ISharedEntity<SamplePlayerDto>>();
foreach (var id in playerIds)
{
var player = await PlayServ.SelectEntity<SamplePlayerEntity, SamplePlayerDto>(
id,
entity => new SamplePlayerDto
{
Id = entity?.Id ?? string.Empty,
Name = entity?.Name ?? string.Empty,
Level = entity?.Level ?? 0
});
players.Add(player);
}Entity and DTO example
[Serializable]
public sealed class SamplePlayerEntity
{
public string Id;
public string Name;
public int Level;
}
public sealed class SamplePlayerDto
{
public string Id { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public int Level { get; set; }
}Mutation after retrieval
player.Update(dto =>
{
dto.Level += 1;
});Scope note
Low-level query builder supports additional constructs internally, but the stable public PlayServ facade is centered on SelectEntity with id + projection.
Summary
In current SDK, data retrieval is key-based through SelectEntity<TEntity, TDto>, producing live synchronized shared entities that can be observed and mutated.
Last updated on